package facadeMod;

import java.util.ArrayList;

public class code {
    // 子系统类：照片管理类
    class PhotoManager {
        private ArrayList<String> photoList = new ArrayList<>();

        public void addPhoto(String photo) {
            photoList.add(photo);
        }

        public ArrayList<String> getPhotoList() {
            return photoList;
        }
    }

    // 子系统类：通讯录管理类
    class ContactManager {
        private ArrayList<String> contactList = new ArrayList<>();

        public void addContact(String contact) {
            contactList.add(contact);
        }

        public ArrayList<String> getContactList() {
            return contactList;
        }
    }

    // 子系统类：短信管理类
    class MessageManager {
        private ArrayList<String> messageList = new ArrayList<>();

        public void addMessage(String message) {
            messageList.add(message);
        }

        public ArrayList<String> getMessageList() {
            return messageList;
        }
    }

    // 外观类：一键备份功能
    class Facade {
        PhotoManager photoManager;
        ContactManager contactManager;
        MessageManager messageManager;

        public Facade() {
            photoManager = new PhotoManager();
            contactManager = new ContactManager();
            messageManager = new MessageManager();
        }

        public void backup() {
            // 备份照片
            ArrayList<String> photos = photoManager.getPhotoList();
            System.out.println("Backing up photos: " + photos);

            // 备份通讯录
            ArrayList<String> contacts = contactManager.getContactList();
            System.out.println("Backing up contacts: " + contacts);

            // 备份短信
            ArrayList<String> messages = messageManager.getMessageList();
            System.out.println("Backing up messages: " + messages);
        }
    }
}
